﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IPC.Communication.Framework.Profinet.Beckhoff
{
    public class AdsDeviceInfo
    {
        public byte Major
        {
            get;
            set;
        }

        public byte Minor
        {
            get;
            set;
        }

        public ushort Build
        {
            get;
            set;
        }

        public string DeviceName
        {
            get;
            set;
        }

        public AdsDeviceInfo()
        {
        }

        public AdsDeviceInfo(byte[] data)
        {
            Major = data[0];
            Minor = data[1];
            Build = BitConverter.ToUInt16(data, 2);
            DeviceName = Encoding.ASCII.GetString(data.RemoveBegin(4)).Trim('\0', ' ');
        }
    }
}
